package com.abl.provider;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
class ProviderController {
    @Value("${server.port}")
    private String serverPort;

    @RequestMapping(value = "/provider/add/{string}")
    public String providerAdd(@PathVariable String string) throws Exception {
        if ("000".equals(string)) {
            throw new Exception("ADD ERROR  000");
        }
        return "serverPort:" + serverPort + "  Provider providerAdd 执行逻辑 add:" + string;
    }

    @RequestMapping(value = "/provider/sub/{string}")
    public String providerSub(@PathVariable String string) throws Exception {
        if ("000".equals(string)) {
            throw new Exception("SUB ERROR  000");
        }
        return "serverPort:" + serverPort + "  Provider providerSub 执行逻辑 sub:" + string;
    }

}